/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package at.tugraz.hidipic.web.propertyeditor;

import at.tugraz.hidipic.model.User;
import java.beans.PropertyEditorSupport;

/**
 *
 * @author mario
 */
public class UserPropertyEditor extends PropertyEditorSupport {

    @Override
    public void setAsText(String incoming) {
        User user = new User();
        user.setUsername(incoming);
        setValue(user);
    }

    @Override
    public String getAsText() {
        if ((User) getValue() != null) {
            return ((User) getValue()).getUsername();
        }
        return null;
    }
}
